<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<meta charset="utf-8">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>SLSystem</title>
    <meta name="keywords" content="面向学习型的开源框架，简洁高效，杜绝过渡封装，展现技术本质本质">
    <meta name="description" content="面向学习型的开源框架，简洁高效，杜绝过渡封装，展现技术本质本质">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/css/bootstrap-select.css?v=3.3.6" rel="stylesheet">
    <link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/css/plugins/toastr/toastr.min.css" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content ">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form class="form-horizontal m-t" id="signupForm" th:action="@{/leaveTeacher/audit}" th:object="${leave}" method="post">

                        <input id="id" name="id" th:value="${leave.id}" class="form-control" type="hidden">
                        <input id="tIds" name="tIds" th:value="${leave.teacherIds}" class="form-control" type="hidden">

                        <div class="form-group">
                            <label class="col-sm-3 control-label">请假学生:</label>
                            <div class="col-sm-8">
                                <input id="studentName" name="studentName" readonly
                                       th:value="${leave.studentName}" class="form-control" type="text">
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">开始日期:</label>
                            <div class="col-sm-8">
                                <input type="text" class="laydate-icon layer-date form-control"
                                       id="startDate" name="startDate" placeholder="请选择请假开始日期" th:value="${leave.startDate}"
                                       onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"
                                       style="background-color: #fff;" disabled readonly="readonly"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">结束日期:</label>
                            <div class="col-sm-8">
                                <input type="text" class="laydate-icon layer-date form-control"
                                       id="endDate" name="endDate" placeholder="请选择请假结束日期" th:value="${leave.endDate}"
                                       onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"
                                       style="background-color: #fff;" disabled readonly="readonly"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">请假原因:</label>
                            <div class="col-sm-8">
                                <input id="reason" name="reason" readonly
                                       th:value="${leave.reason}" class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">请假课程:</label>
                            <div class="col-sm-8">
                                <select name="teacherIds" id="teacherIds"
                                        data-live-search="true"
                                        class="form-control chosen-select selectpicker"
                                        multiple="multiple"
                                        Title="--选择请假课程--"
                                        data-selected-text-format="count>5"
                                        data-actions-box="false"
                                        tabindex="2"
                                        required>
                                    <option th:each="teacher:${teachers}" disabled
                                            th:value="${teacher.teacherId}"
                                            th:text="${teacher.name}+'--'+${teacher.className}"></option>
                                </select>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-3 control-label">审核结果:</label>
                            <div class="col-sm-8">
                                <input id="state" name="state" th:value="${leave.state}" readonly class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">审核意见:</label>
                            <div class="col-sm-8">
                                <input id="opinion" name="opinion" th:value="${leave.opinion}" readonly class="form-control" type="text">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">审核日期:</label>
                            <div class="col-sm-8">
                                <input type="text" class="laydate-icon layer-date form-control" disabled
                                       id="auditDate" name="auditDate" placeholder="请选择请假结束日期" th:value="${leave.auditDate}"
                                       onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"
                                       style="background-color: #fff;" readonly="readonly"/>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-8 col-sm-offset-3">
                                <a type="button" class="btn btn-primary" th:href="@{/toLeaveInstructorHistory}">返回</a>
                            </div>
                        </div>

                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<script src="/js/jquery.min.js?v=2.1.4" th:src="@{/js/jquery.min.js?v=2.1.4}"></script>
<script src="/js/bootstrap.min.js?v=3.3.6" th:src="@{/js/bootstrap.min.js?v=3.3.6}"></script>
<script src="/js/bootstrap-select.js?v=3.3.6" th:src="@{/js/bootstrap-select.js?v1.6.3}"></script>
<script type="text/javascript" src="/js/plugins/layer/laydate/laydate.js"></script>

<!-- 自定义js -->
<script src="/js/content.js?v=1.0.0" th:src="@{/js/content.js?v=1.0.0}"></script>

<!-- jQuery Validation plugin javascript-->
<script src="/js/ajax-util.js"></script>
<script src="/js/plugins/validate/jquery.validate.min.js" th:src="@{/js/plugins/validate/jquery.validate.min.js}"></script>
<script src="/js/plugins/validate/messages_zh.min.js" th:src="@{/js/plugins/validate/messages_zh.min.js}"></script>
<script src="/js/plugins/layer/layer.min.js" th:src="@{/js/plugins/layer/layer.min.js}"></script>

<!-- 自定义js方法 -->
<script type="text/javascript">

    //检查输入框值填写
    function checkValue(obj) {
        var tValue = $(obj).val().trim();
        if (tValue == null || tValue == '') {
            layer.msg("请输入正确的内容");
            return false;
        }
    }

    $(document).ready(function () {
        $(".selectpicker").selectpicker({
            'selectedText': 'cat'
        });

        //调用初始化教师下拉多选值
        initSelectedTeacher();
        //初始化教师下拉多选值
        function initSelectedTeacher(){
            //1.获得后台传入的选中的教师ids
            var tIds = $('#tIds').val();
            //2.以","拆分成数组
            var teacherArr = tIds.split(",");
            //3.给teacherIds多选下拉选赋值
            $("#teacherIds").selectpicker("val",teacherArr);
        }
    });

    //点击同意或者拒绝时，给state对应赋值，1-同意，2-拒绝
    function checkOpinion(opinion) {
        $("#state").val(opinion);
    }


</script>

</body>
</html>
